package com.example.dessertstoressm.Service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.dessertstoressm.Mapper.SequenceMapper;
import com.example.dessertstoressm.Service.SequenceService;
import com.example.dessertstoressm.domain.Sequence;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

@Service
public class SequenceServiceImpl implements SequenceService {
    @Resource
    private SequenceMapper sequenceMapper;

    @Override
    public Sequence getSequence(Sequence sequence){
        QueryWrapper<Sequence> wrapper = new QueryWrapper<>();
        wrapper.eq("name",sequence.getName());
        return this.sequenceMapper.selectOne(wrapper);
    }

    @Override
    public void updateSequence(Sequence sequence){
        QueryWrapper<Sequence> wrapper = new QueryWrapper<>();
        wrapper.eq("name",sequence.getName());
        this.sequenceMapper.update(sequence,wrapper);
    }
}
